package com.ymatou.iapi.login.testcase;

import java.util.Map;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.login.parameter.BindSinaWeiboUserRequestDtoBean;
import com.ymatou.iapi.login.parameter.SinaWeiBoUserRequestDtoBean;
import com.ymatou.iapi.login.parameter.UnBindThirdPartyAccountDtoBean;
import com.ymatou.iapi.login.service.BindSinaWeiboUserRequestDtoCall;
import com.ymatou.iapi.login.service.LoginAuthCall;
import com.ymatou.iapi.login.service.SinaWeiBoUserRequestDtoCall;
import com.ymatou.iapi.login.service.UnBindThirdPartyAccountDtoCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymatou.iapi.userservice.parameter.enums.ThirdPartyTypeEnum;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.database.model.ThirdpartyUserbind;
import com.ymttest.database.model.ThirdpartyUserbindHistory;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.database.sqlwapper.YmtUsersWapper;
import com.ymttest.utils.constant.ECode;
import com.ymttest.utils.constant.ThirdPartyType;
/**
*绑定微博账号接口
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_BindSinaWeiboUserRequestDto{
	private static BindSinaWeiboUserRequestDtoBean bindsinaweibouserrequestdtoBean;
	private static BindSinaWeiboUserRequestDtoCall bindsinaweibouserrequestdtoCall;
	private static YmtUsersWapper ymtUser;
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("绑定微博账号接口");
		ymtUser = new YmtUsersWapper();
	}

	@Before
	public void caseUp() {
		bindsinaweibouserrequestdtoBean=new BindSinaWeiboUserRequestDtoBean();
		bindsinaweibouserrequestdtoCall=new BindSinaWeiboUserRequestDtoCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(bindsinaweibouserrequestdtoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_001() {
		Logger.start(true,"新浪微博账号未绑定过，绑定成功");
		try {
			
			Logger.comment("前置准备：新创建一个用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();
			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);			
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result = bindsinaweibouserrequestdtoCall.getMap();
			
			// 验证返回
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result.get("ResponseCode")).intValue()+"", "验证Code信息");
			Logger.verifyEquals(true, result.get("Success"), "验证操作成功");
		
			// 验证DB
			Logger.comment("验证数据库");
			verifyDB(userId, bindsinaweibouserrequestdtoBean.getWeiBoUser());
			
			Logger.comment("验证用该账号码头登陆成功");
			LoginAuthCall lac = JUserCallService.login(regbean.getLoginId(), regbean.getPas(), "app", regbean.getClientIp(),regbean.getDeviceId());
			Logger.verifyEquals(true, lac.getSuccess(), "验证Success");
			Logger.verifyEquals(regbean.getLoginMobile(), lac.getUserData().getLoginMobile(), "验证UserName");

			Logger.comment("验证微博联合登陆成功");
			SinaWeiBoUserRequestDtoCall userRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(bindsinaweibouserrequestdtoBean.getWeiBoUser());
			Logger.verifyEquals(ECode.SUCCESS, userRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", userRequestDtoCall.getString("Success"), "验证是否成功");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_002() {
		Logger.start(true,"新浪微博账号绑定过当前账号，返回已绑定过");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();
			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);			
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result = bindsinaweibouserrequestdtoCall.getMap();
			
			Logger.verifyEquals(ECode.SUCCESS, String.valueOf(((Double)result.get("ResponseCode")).intValue()), "验证Code信息");
			
			Logger.comment("再次绑定");
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result2 = bindsinaweibouserrequestdtoCall.getMap();
			
			// 验证返回
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result.get("ResponseCode")).intValue()+"", "验证Code信息");
			Logger.verifyEquals(true, result.get("Success"), "验证操作成功");
	
			// 验证DB
			Logger.comment("验证数据库");
			verifyDB(userId, bindsinaweibouserrequestdtoBean.getWeiBoUser());
			
			Logger.comment("验证用该账号码头登陆成功");
			LoginAuthCall lac = JUserCallService.login(regbean.getLoginId(), regbean.getPas(), "app", regbean.getClientIp(),regbean.getDeviceId());
			Logger.verifyEquals(true, lac.getSuccess(), "验证Success");
			Logger.verifyEquals(regbean.getLoginMobile(), lac.getUserData().getLoginMobile(), "验证UserName");

			Logger.comment("验证新浪微博联合登陆成功");
			SinaWeiBoUserRequestDtoCall userRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(bindsinaweibouserrequestdtoBean.getWeiBoUser());
			Logger.verifyEquals(ECode.SUCCESS, userRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", userRequestDtoCall.getString("Success"), "验证是否成功");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_003() {
		Logger.start(true,"新浪微博账号已绑定过其他账号，绑定失败");
		try {
			Logger.comment("前置准备：新创建一个用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();
			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result = bindsinaweibouserrequestdtoCall.getMap();
			
			UserRegisterInfoRequestDtoBean regbean1 = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc1 = JUserCallService.UserRegisterInfoRequestDtoCall(regbean1);
			
			JsonObject registerResult1 = urrc1.getJsonObject().get("Result").getAsJsonObject();
			String token1=registerResult1.get("Token").getAsString();
			int userId1 = urrc1.getUserid();
			
			bindsinaweibouserrequestdtoBean.setToken(token1);
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result1 = bindsinaweibouserrequestdtoCall.getMap();			
			
			// 验证返回
			Logger.verifyEquals("401",  String.valueOf(((Double)result1.get("ResponseCode")).intValue()), "验证Code信息");
			Logger.verifyEquals(false, result1.get("Success"), "验证操作成功");
			Logger.verifyEquals("此微博账号已绑定", result1.get("LastErrorMessage"), "验证Msg信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_004() {
		Logger.start(true,"用户绑定了A新浪微博账号->解绑A新浪微博账号 ->用A登录失败 ->绑定A新浪微博账号->绑定成功 ->用A登录成功");
		try {
			
			Logger.comment("新创建一个用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			Logger.comment("用户绑定了A新浪微博账号");
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();
			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);			
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result = bindsinaweibouserrequestdtoCall.getMap();
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result.get("ResponseCode")).intValue()+"", "验证Code信息");
			
			Logger.comment("解绑A新浪微博账号");
			UnBindThirdPartyAccountDtoBean  unBindThirdPartyAccountDtoBean  = JUserCallService.initUnBindThirdPartyAccountDtoBean(bindsinaweibouserrequestdtoBean.getWeiBoUser().getSWeiboUserId(), ThirdPartyType.WEIBO, userId);
			UnBindThirdPartyAccountDtoCall  unBindThirdPartyAccountDtoCall  = JUserCallService.unBindThirdPartyAccountDto(unBindThirdPartyAccountDtoBean);
			Logger.verifyEquals("200", unBindThirdPartyAccountDtoCall.getString("ResponseCode"), "验证Code信息");
			
			Logger.comment("验证用该账号码头登陆成功");
			LoginAuthCall lac = JUserCallService.login(regbean.getLoginId(), regbean.getPas(), "app", regbean.getClientIp(),regbean.getDeviceId());
			Logger.verifyEquals(true, lac.getSuccess(), "验证Success");
			Logger.verifyEquals(regbean.getLoginMobile(), lac.getUserData().getLoginMobile(), "验证UserName");
			String ntoken=lac.getUserData().getSign();
			Logger.comment("验证新浪微博联合登陆失败");
			SinaWeiBoUserRequestDtoCall userRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(bindsinaweibouserrequestdtoBean.getWeiBoUser());
			Logger.verifyEquals(ECode.FAILED400, userRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", userRequestDtoCall.getString("Success"), "验证是否成功");
				
			Logger.comment("用户绑定了A新浪微博账号");
			bindsinaweibouserrequestdtoBean.setToken(ntoken);
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result1 = bindsinaweibouserrequestdtoCall.getMap();
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result1.get("ResponseCode")).intValue()+"", "验证Code信息");
			
			Logger.comment("验证用该账号码头登陆成功");
			lac = JUserCallService.login(regbean.getLoginId(), regbean.getPas(), "app", regbean.getClientIp(),regbean.getDeviceId());
			Logger.verifyEquals(true, lac.getSuccess(), "验证Success");
			Logger.verifyEquals(regbean.getLoginMobile(), lac.getUserData().getLoginMobile(), "验证UserName");

			Logger.comment("验证新浪微博联合登陆成功");
			userRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(bindsinaweibouserrequestdtoBean.getWeiBoUser());
			Logger.verifyEquals(ECode.SUCCESS, userRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", userRequestDtoCall.getString("Success"), "验证是否成功");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_005() {
		Logger.start(true,"用户绑定了A新浪微博账号->解绑A新浪微博账号->绑定B新浪微博账号->绑定成功->用A登录失败 ->用B登录成功");
		try {
			Logger.comment("新创建一个用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			Logger.comment("用户绑定了A新浪微博账号");
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();
			
			BindSinaWeiboUserRequestDtoBean  bindsinaweibouserrequestdtoBean1 = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);			
			BindSinaWeiboUserRequestDtoCall  bindsinaweibouserrequestdtoCall1 = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean1);
			Map result1 = bindsinaweibouserrequestdtoCall1.getMap();
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result1.get("ResponseCode")).intValue()+"", "验证Code信息");
			
			Logger.comment("解绑A新浪微博账号");
			UnBindThirdPartyAccountDtoBean  unBindThirdPartyAccountDtoBean  = JUserCallService.initUnBindThirdPartyAccountDtoBean(bindsinaweibouserrequestdtoBean1.getWeiBoUser().getSWeiboUserId(), ThirdPartyType.WEIBO, userId);
			UnBindThirdPartyAccountDtoCall  unBindThirdPartyAccountDtoCall  = JUserCallService.unBindThirdPartyAccountDto(unBindThirdPartyAccountDtoBean);
			Logger.verifyEquals("200", unBindThirdPartyAccountDtoCall.getString("ResponseCode"), "验证Code信息");
			
			Logger.comment("用户绑定了B新浪微博账号");			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);			
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result2 = bindsinaweibouserrequestdtoCall.getMap();
		
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result2.get("ResponseCode")).intValue()+"", "验证Code信息");
			Logger.verifyEquals(true, result2.get("Success"), "验证操作成功");
	
			// 验证DB
			Logger.comment("验证数据库");
			verifyDB(userId, bindsinaweibouserrequestdtoBean.getWeiBoUser());
			
			Logger.comment("验证用该账号码头登陆成功");
			LoginAuthCall lac = JUserCallService.login(regbean.getLoginId(), regbean.getPas(), "app", regbean.getClientIp(),regbean.getDeviceId());
			Logger.verifyEquals(true, lac.getSuccess(), "验证Success");
			Logger.verifyEquals(regbean.getLoginMobile(), lac.getUserData().getLoginMobile(), "验证UserName");

			Logger.comment("验证A新浪微博联合登陆失败");
			SinaWeiBoUserRequestDtoCall userRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(bindsinaweibouserrequestdtoBean1.getWeiBoUser());
			Logger.verifyEquals(ECode.FAILED400, userRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", userRequestDtoCall.getString("Success"), "验证是否成功");
					
			Logger.comment("验证B新浪微博联合登陆成功");
			userRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(bindsinaweibouserrequestdtoBean.getWeiBoUser());
			Logger.verifyEquals(ECode.SUCCESS, userRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("true", userRequestDtoCall.getString("Success"), "验证是否成功");		
		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_006() {
		Logger.start(false,"未输入token，失败");
		try {
			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(null);			
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result = bindsinaweibouserrequestdtoCall.getMap();
			
			// 验证返回		
			Logger.verifyEquals(ECode.ERROR400, ((Double)result.get("ResponseCode")).intValue()+"", "验证Code信息");
			Logger.verifyEquals(false, result.get("Success"), "验证操作成功");
			Logger.verifyEquals("错误的请求参数|Token不能为空", result.get("LastErrorMessage"), "验证Msg信息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_007() {
		Logger.start(false,"未输入业务端类型");
		try {
			
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();
			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);	
			bindsinaweibouserrequestdtoBean.setClientType(null);
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result = bindsinaweibouserrequestdtoCall.getMap();
			
			Logger.verifyEquals(ECode.FAILED400, ((Double)result.get("ResponseCode")).intValue()+"", "验证Code信息");
			Logger.verifyEquals(false, result.get("Success"), "验证操作成功");
				
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_008() {
		Logger.start(false,"未输入新浪微博账号，失败");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			
			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token=registerResult.get("Token").getAsString();
			int userId = urrc.getUserid();
			
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token);	
			bindsinaweibouserrequestdtoBean.getWeiBoUser().setSWeiboUserId(null);
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result = bindsinaweibouserrequestdtoCall.getMap();
			
			Logger.verifyEquals(ECode.ERROR400, ((Double)result.get("ResponseCode")).intValue()+"", "验证Code信息");
			Logger.verifyEquals(false, result.get("Success"), "验证操作成功");
			Logger.verifyEquals("错误的请求参数|第三方用户编号不能为空", result.get("LastErrorMessage"), "验证Msg信息");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_BindSinaWeiboUserRequestDto_009() {
		Logger.start(true,"用户A绑定了A阿里账号->解绑A阿里账号->用户B绑定A阿里账号->用户B解绑A阿里账号");
		try {
			
			Logger.comment("新创建一个用户A");
			UserRegisterInfoRequestDtoBean regbean1 = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc1 = JUserCallService.UserRegisterInfoRequestDtoCall(regbean1);
				
			JsonObject registerResult1 = urrc1.getJsonObject().get("Result").getAsJsonObject();
			String token1=registerResult1.get("Token").getAsString();
			int userId1 = urrc1.getUserid();
			
			Logger.comment("新创建一个用户B");
			UserRegisterInfoRequestDtoBean regbean2 = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc2 = JUserCallService.UserRegisterInfoRequestDtoCall(regbean2);
		
			JsonObject registerResult2 = urrc2.getJsonObject().get("Result").getAsJsonObject();
			String token2=registerResult2.get("Token").getAsString();
			int userId2 = urrc2.getUserid();
		
			Logger.comment("用户A绑定了A新浪微博账号");				
			bindsinaweibouserrequestdtoBean = JUserCallService.initBindSinaWeiboUserRequestDtoBean(token1);			
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result1 = bindsinaweibouserrequestdtoCall.getMap();
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result1.get("ResponseCode")).intValue()+"", "验证Code信息");
			
			Logger.comment("解绑A新浪微博账号");
			UnBindThirdPartyAccountDtoBean  unBindThirdPartyAccountDtoBean  = JUserCallService.initUnBindThirdPartyAccountDtoBean(bindsinaweibouserrequestdtoBean.getWeiBoUser().getSWeiboUserId(), ThirdPartyType.WEIBO, userId1);
			UnBindThirdPartyAccountDtoCall  unBindThirdPartyAccountDtoCall  = JUserCallService.unBindThirdPartyAccountDto(unBindThirdPartyAccountDtoBean);
			Logger.verifyEquals("200", unBindThirdPartyAccountDtoCall.getString("ResponseCode"), "验证Code信息");
		
			Logger.comment("用户B绑定A阿里账号");
			bindsinaweibouserrequestdtoBean.setToken(token2);			
			bindsinaweibouserrequestdtoCall = JUserCallService.bindSinaWeiboUserRequestDto(bindsinaweibouserrequestdtoBean);
			Map result2 = bindsinaweibouserrequestdtoCall.getMap();
			Logger.verifyEquals(ECode.SUCCESS, ((Double)result2.get("ResponseCode")).intValue()+"", "验证Code信息");
		
			Logger.comment("用户B解绑A阿里账号");
			UnBindThirdPartyAccountDtoBean  unBindThirdPartyAccountDtoBean2  = JUserCallService.initUnBindThirdPartyAccountDtoBean(bindsinaweibouserrequestdtoBean.getWeiBoUser().getSWeiboUserId(), ThirdPartyType.WEIBO, userId2);
			UnBindThirdPartyAccountDtoCall  unBindThirdPartyAccountDtoCall2  = JUserCallService.unBindThirdPartyAccountDto(unBindThirdPartyAccountDtoBean2);
			Logger.verifyEquals("200", unBindThirdPartyAccountDtoCall2.getString("ResponseCode"), "验证Code信息");
		
			Logger.comment("验证A新浪微博联合登陆失败");
			SinaWeiBoUserRequestDtoCall userRequestDtoCall = JUserCallService.sinaWeiBoUserRequestDto(bindsinaweibouserrequestdtoBean.getWeiBoUser());
			Logger.verifyEquals(ECode.FAILED400, userRequestDtoCall.getString("ResponseCode"), "验证code");
			Logger.verifyEquals("false", userRequestDtoCall.getString("Success"), "验证是否成功");
			Logger.verifyEquals("为了您的账户安全，请绑定你的手机号码", userRequestDtoCall.getString("LastErrorMessage"), "验证LastErrorMessage");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	private void verifyDB(Integer uid, SinaWeiBoUserRequestDtoBean cq) {
		//TODO 需要检查字段
		JUserWapper ju=new JUserWapper();
		
		Logger.comment("验证thirdparty_userbind");
		ThirdpartyUserbind thirdinfo = ju.selectthirdpartyuserbind(uid).get(0);
		Logger.verifyEquals(cq.getSWeiboUserId(), thirdinfo.getThirdPartyId(), "验证ThirdPartyId");
		Logger.verifyEquals(ThirdPartyTypeEnum.Weibo.getCode(), thirdinfo.getThirdPartyType(), "验证ThirdPartyType");
		
		Logger.comment("验证thirdparty_userbind_history");
		ThirdpartyUserbindHistory thirdinfohist = ju.selectthirdpartyuserbindhistory(uid).get(0);
		Logger.verifyEquals(true, thirdinfohist.getBinding(), "验证binding状态");
		Logger.verifyEquals(cq.getRegSource().getCode(), thirdinfohist.getAppSource(), "验证AppSource");
		Logger.verifyEquals(cq.getClientIp(), thirdinfohist.getClientIp(), "验证ClientIp");
		Logger.verifyEquals(cq.getDeviceId(), thirdinfohist.getDeviceId(), "验证DeviceId");
		Logger.verifyEquals(cq.getSMail(), thirdinfohist.getEmail(), "验证Email");
		Logger.verifyEquals(cq.getEquimentid(), thirdinfohist.getEquimentid(), "验证Equimentid");
		Logger.verifyEquals(cq.getMobile(), thirdinfohist.getLoginMobile(), "验证LoginMobile");
		Logger.verifyEquals(cq.getTerminalSource().getCode(), thirdinfohist.getTerminalSource(), "验证TerminalSource");
		
		Logger.verifyEquals(cq.getSToken(), thirdinfohist.getThirdPartyToken(), "验证ThirdPartyToken");
	}
	
}